package servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class Exit extends HttpServlet {
    private static final long serialVersionUID = -7690791284761544143L;

    /** 用户从大厅页面退出时，servlet上下文将从大厅用户名称集合中移除此用户的名称 */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 如果请求发出之前的会话已过期，那么注销的会话的id将是另一个值
        req.getSession().invalidate();
        resp.sendRedirect("entrance");
    }

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }
}
